package com.frozenc.enums;

/**
 * Created by FrozenC on 2016/9/8.
 */
public enum UserType implements GenericEnum {

    ADMIN(0,"管理员"),EDITOR(1, "编辑人员"),CHECKER(2, "审核发布人员"),USER(3,"普通用户");

    private int code;

    private String name;

    UserType(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public boolean hasAdminAuth(){
        return this.equals(ADMIN);
    }

    public boolean hasEditAuth(){
        return this.equals(ADMIN) || this.equals(EDITOR);
    }

    public boolean hasCheckAuth(){
        return this.equals(ADMIN) || this.equals(CHECKER);
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }
}
